home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-05 | 2.4 KB | 85 lines | [TEXT/KAHL] |
- //----------------------------------------------------------------------------------
- // File : panelAssist.c
- // Date : August 24, 1994
- // Author : Jim Stout
- // Purpose : Some utility routines for use with the tabPanel CDEF.
- //
- //----------------------------------------------------------------------------------
- #include "dialogAssist.h"
- #include "panelAssist.h"
-
- //----------------------------------------------------------------------------------
- // Function: panelSwap
- // Purpose: change a dialog panel in a dialog that uses the tabPanel CDEF.
- //
- // NOTE: This routine assumes that the CountDITL, AppendDITL & ShortenDITL are
- // available. (System 7 or CommToolbox is installed);
- //
- // returns: void
- //----------------------------------------------------------------------------------
-
- extern void panelSwap(DialogPtr theDialog, short firstPANEL,
- short fromPanel, short toPanel, short ctlToKeep)
- {
- Handle h;
- short toRemove=0;
-
- toRemove = CountDITL(theDialog) - ctlToKeep;
-
- h = GetResource('DITL', firstPANEL+toPanel);
- if(h) {
- if(toRemove)
- ShortenDITL(theDialog, toRemove);
- AppendDITL(theDialog, h, overlayDITL);
- ReleaseResource(h);
- }
- else {
- ShortenDITL(theDialog, toRemove);
- toRemove = 0;
- }
-
- }
-
- //----------------------------------------------------------------------------------
- // Function: panelCmdKey
- // Purpose: allow a cmd-key to operate the tabPanel CDEF.
- //
- // returns: void
- //----------------------------------------------------------------------------------
-
- extern Boolean panelCmdKey(DialogPtr theDialog, short panelID, char c, short *theItem)
- {
- short num;
-
- num = daGetCtlMax(theDialog, panelID) + 0x30;
- if(c >= 0x31 && c <= num) {
- num = c - 0x30;
- daSetCtlValue(theDialog, panelID, num);
- *theItem = panelID;
- return(TRUE);
- }
- return(FALSE);
- }
- //----------------------------------------------------------------------------------
- // Function: panelCmdTab
- // Purpose: allow a cmd-tab to cycle thru tabs on the tabPanel CDEF.
- //
- // returns: void
- //----------------------------------------------------------------------------------
-
- extern Boolean panelCmdTab(DialogPtr theDialog, short panelID, char c, short *theItem)
- {
- short max,val;
-
- max = daGetCtlMax(theDialog, panelID);
- val = daGetCtlValue(theDialog, panelID);
- if(c == _TAB) {
- val++;
- if(val > max)
- val = 1;
- daSetCtlValue(theDialog, panelID, val);
- *theItem = panelID;
- return(TRUE);
- }
- return(FALSE);
- }